class LinkList {
  list = [];

  insert(index, value) {
    this.list[index] = value;
  }

  delete(index) {
    // this.list.splice(index, 1)
    delete this.list[index]
  }

  edit(index, value) {
    this.list[index] = value
  }

  pushNode(value) {
    this.list.push(value)
  }

  size() {
    return this.list.length
  }

  rever() {
    this.list.reverse();
  }
  repeat(value) {
    return this.list.reduce((total, current) => {
      if(current === value) return total + 1
      return total
    }, 0)
  }
  itemType(value) {
    return typeof value
  }
  sum(start, end) {
    console.log(this.list.slice(start, end + 1))
    return this.list.slice(start, end + 1).reduce((total, current) => {
      return total + current
    }, 0)
  }
  zebra(value) {
    return value % 2 === 0 ? '偶数':"奇数"
  }
}

const l1 = new LinkList();


l1.pushNode(1)
l1.pushNode(2)
l1.pushNode(2)
l1.pushNode(2)

l1.pushNode(2)
l1.pushNode(3)


console.log(l1.zebra(1))


